package com.xiaolong.sojiaziademo;

import android.annotation.SuppressLint;

import com.xiaolong.sojiaziademo.util.Logger;
import com.xiaolong.sojiaziademo.util.Zprint;

public class Native {
    private static final String TAG = "dumpDex";
    private static Native inner = null;

    @SuppressLint("UnsafeDynamicallyLoadedCode")
    private Native(String libPath) {
        try {
            String so = String.format("%s/lib/arm64/libBias.so", libPath);
            Zprint.log(Native.class, String.format("so lib path %s", so, inner), TAG);
            System.load(so);// todo 修改架构版本为动态, 库名称为配置文件取
        } catch (Exception e) {
            Zprint.log(this.getClass(), e.getMessage());
            e.printStackTrace();
        }
    }

    public static Native getInner(String libPath) {
        if (inner == null) {
            return new Native(libPath);
        }
        return inner;
    }

    public native void dump(String targetPackageName);
}
